<?php

    #-------------------------------------------------------------#
	# This file is part of the Tekuna MVC Microframework for PHP. #
	# (c) 2009 Niels Jäckel <niels.jaeckel@tekuna.org>            #
	# Please visit http://tekuna.org/ for more information.       #
	#                                                             #
	# This software is licensed under the MIT License. Please     #
	# view the LICENSE file for the full text of this license.    #
    #-------------------------------------------------------------#


	class ExceptionTest extends AbstractTekunaTestCase {


		private function producePHPWarning() {

			strpos();
		}


		public function testWarning() {

			try {

				$this -> producePHPWarning();
				$this -> fail('PHPWarningException expected');
			}
			catch (PHPWarningException $e) {

				$this -> pass();
			}
		}


		private function producePHPNotice() {

			$a = B;
		}


		public function testNotice() {

			try {

				$this -> producePHPNotice();
				$this -> fail('PHPNoticeException expected');
			}
			catch (PHPNoticeException $e) {

				$this -> pass();
			}
		}


		public function testErrorLevel() {

			// deactivate notices
			error_reporting(E_ALL && !E_NOTICE);

			// produce notice and fail if the exception comes
			try {

				$this -> producePHPNotice();
				$this -> pass();
			}
			catch (PHPNoticeException $e) {

				$this -> fail('PHPNoticeException expected');
			}
		}
	}



